<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/6/9 0009
 * Time: 下午 4:01
 */


use yii\helpers\Html;
use yii\widgets\LinkPager;
use yii\grid\GridView;
use yii\bootstrap\Modal;
use app\common\Functions;
/**
 * @var yii\web\View $this
 * @var amnah\yii2\user\Module $module
 * @var array $actions
 */
global $regionTypes2;
global $prodAttrCodes;
$regionTypes2 = $regionTypes;
$module = $this->context->module;


$prodAttrCodes=[];



// 增加展示的字段
$columns = [];
$i = 0;


$columns[$i]['attribute'] = 'id';
$columns[$i]['options'] = ['style'=>'width:30px'];

$i++;
//订单类型
$columns[$i]['label'] = '数据日期';
$columns[$i]['attribute'] = 'data_date';
$columns[$i]['options'] = ['style'=>'width:80px'];
$columns[$i]['value']   = function($model)
{
    return $model->data_date;
};





$i++;
//订单类型
$columns[$i]['label'] = '维护粉丝数';
$columns[$i]['attribute'] = 'fans_amount';
$columns[$i]['options'] = ['style'=>'width:60px'];
$columns[$i]['value']   = function($model)
{
    return $model->fans_amount;
};
$i++;
//订单类型
$columns[$i]['label'] = '日文章';
$columns[$i]['attribute'] = 'article_amount';
$columns[$i]['options'] = ['style'=>'width:60px'];
$columns[$i]['value']   = function($model)
{
    return $model->article_amount;
};
$i++;
//订单类型
$columns[$i]['label'] = '日发布';
$columns[$i]['attribute'] = 'publish_amount';
$columns[$i]['options'] = ['style'=>'width:60px'];
$columns[$i]['value']   = function($model)
{
    return $model->publish_amount;
};
$i++;
//订单类型
$columns[$i]['label'] = '日阅读';
$columns[$i]['attribute'] = 'readed_fee';
$columns[$i]['options'] = ['style'=>'width:60px'];
$columns[$i]['value']   = function($model)
{
    return $model->readed_fee;
};
$i++;
//订单类型
$columns[$i]['label'] = '日转发';
$columns[$i]['attribute'] = 'repeat_amount';
$columns[$i]['options'] = ['style'=>'width:60px'];
$columns[$i]['value']   = function($model)
{
    return $model->repeat_amount;
};
$i++;
//订单类型
$columns[$i]['label'] = '日增渠道';
$columns[$i]['attribute'] = 'channel_amount';
$columns[$i]['options'] = ['style'=>'width:60px'];
$columns[$i]['value']   = function($model)
{
    return $model->channel_amount;
};
$i++;
//订单类型
$columns[$i]['label'] = '日咨询量';
$columns[$i]['attribute'] = 'advice_amount';
$columns[$i]['options'] = ['style'=>'width:60px'];
$columns[$i]['value']   = function($model)
{
    return $model->advice_amount;
};





$i++;
//操作选项
// $columns[$i]['class']   = 'app\common\grid\ActionColumn';
$columns[$i]['options'] = ['style'=>'width:110px'];

$columns[$i]['content']   = function($model) use ($now_url)
{


    $createUrlModelWx                     = [];
    $createUrlModelWx['id']            =  'activity-update-sem-link';
    $createUrlModelWx['class']        = 'btn btn-xs btn-warning activity-update-sem-link';
    $createUrlModelWx['data-toggle'] = 'modal';
    $createUrlModelWx['data-target'] = '#create-sem-modal';
    $createUrlModelWx['label'] = '微信修改';
    $createUrlModelWx['title'] = '微信推广数据修改';
    $createUrlModelWx ['data-last_url']         = $now_url;
    $createUrlModelWx ['data-id']         = $model->id;
    $createUrlModelWx ['data-wx']         = 1;

    $btns = [];

    $btnBegin = Html::a( '微信修改', '#', $createUrlModelWx);



    $btns[]   = Html::a( '删除', ['delete', 'id'=>$model->id , 'last_url'=> $now_url], [ 'label'=>'删除', 'title' => '删除']);

    return Functions::getActionDropdownContext($btnBegin, $btns);

};






?>

<?php
//'layout' => "{items}{summary}{pager}",
echo GridView::widget([
    'dataProvider' => $dataProvider,
    'filterModel' => $searchModel,
    'layout' => "{items}{summary}{pager}",
    'options'=>['id'=>'grid', 'class'=>'col-sm-12'],
    'tableOptions'=>[ 'class'=>'table table-bordered table-striped dataTable'],
    'columns' => $columns,
    /*  'components' => ['formatter' => ['datetimeFormat' => 'yyyy-MM-dd HH:mm:',]]*/

]);





?>



